package br.com.ifet.classes.projetoandroidmobile;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Principal extends Activity {
	
	private Intent itPrincipalToCadastro;
	private Intent itPrincipalToCarregadora;
	private Button btnNovo;
	private Button btnCarregar;
	private Button btnSair;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.principal);
        itPrincipalToCadastro = new Intent(Principal.this, Cadastro.class);
        itPrincipalToCarregadora = new Intent(Principal.this, Carregadora.class);
        btnNovo = (Button) findViewById(R.id.btnNovo);
        btnCarregar = (Button) findViewById(R.id.btnCarregar);
        btnSair = (Button) findViewById(R.id.btnSair);
        
        btnNovo.setOnClickListener(new OnClickListener() {
        	public void onClick(View arg0){
        		startActivity(itPrincipalToCadastro);
        		
        	}
        });
        
        btnCarregar.setOnClickListener(new OnClickListener() {
        	public void onClick(View arg0){
        		startActivity(itPrincipalToCarregadora);
        	}
        });
        
        btnSair.setOnClickListener(new OnClickListener() {
        	public void onClick(View arg0){
        		finish();
        	}
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.principal, menu);
        return true;
    }
}
